﻿
using System;
using Guia.Elements;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WpfTestApplication;


namespace GuiaTest
{
    [TestClass]
    public class CheckBoxTest : AbstractWindowTest
    {   
        public CheckBoxTest()
        {
        }

        protected override Type TestWindowType()
        {
            return typeof(CheckBoxTestWindow);
        }

        protected override string TestWindowName()
        {
            return "CheckBoxTestWindow";
        }

        [TestMethod]
        public void TestCheck()
        {
            CheckBox checkBox = window.Get<CheckBox>("checkBoxTest");
            checkBox.Check();
            Assert.AreEqual(true, checkBox.IsChecked);
        }

        [TestMethod]
        public void TestUnCheck()
        {
            CheckBox checkBox = window.Get<CheckBox>("checkBoxTest");
            // already unchecked
            checkBox.UnCheck();
            Assert.AreEqual(false, checkBox.IsChecked);
            // now it is checked
            checkBox.Check();
            checkBox.UnCheck();
            Assert.AreEqual(false, checkBox.IsChecked);
        }

        [TestMethod]
        public void TestDoToggle()
        {
            CheckBox checkBox = window.Get<CheckBox>("checkBoxTest");
            // first is not checked
            Assert.AreEqual(false, checkBox.IsChecked);
            checkBox.Toggle();
            // now checked
            Assert.AreEqual(true, checkBox.IsChecked);
            checkBox.Toggle();
            Assert.AreEqual(false, checkBox.IsChecked);
        }
    }
}
